<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:th="http://www.thymeleaf.org" >
<head>
	<meta charset="UTF-8">
	<title>Title</title>
</head>
<script type="text/javascript" th:src="@{../jquery-2.1.4.min.js}"></script>
<script type="text/javascript" th:src="@{../bootstrap-3.3.7-dist/js/bootstrap.min.js}"></script>
<link type="text/css" rel="stylesheet" th:href="@{/bootstrap-3.3.7-dist/css/bootstrap.min.css}">
<script type="text/javascript" th:src="@{../bootstrap-treeview/bootstrap-treeview.min.js}"></script>
<link type="text/css" rel="stylesheet" th:href="@{../bootstrap-treeview/bootstrap-treeview.min.css}">
<script type="text/javascript" th:src="@{../bootStrap-addTabs/bootstrap.addtabs.min.js}"></script>
<link type="text/css" rel="stylesheet" th:href="@{../bootStrap-addTabs/bootstrap.addtabs.css}">
<script type="text/javascript" th:src="@{../bootstrap-table/bootstrap-table.min.js}"></script>
<script type="text/javascript" th:src="@{../bootstrap-table/locale/bootstrap-table-zh-CN.min.js}"></script>
<link type="text/css" rel="stylesheet" th:href="@{../bootstrap-table/bootstrap-table.min.css}">

<script type="text/javascript" th:src="@{../bootstrap-fileinput/js/fileinput.min.js}"></script>
<script th:src="@{../bootstrap-fileinput/js/locales/zh.js}"></script>

<body>
<div id="tb">
</div>
<table id="myTable"></table>

</body>
<script>
	function updatePass(){
		var pass=prompt("请输入要修改的密码")
		$.ajax({
			type:"get",
			url:"user/updatePass",
			data:{"pass":pass},
			dataType:"json",
			success :function (){
				alert("修改成功")
			}
		})
	}

	$("#myTable").bootstrapTable({
		url:"user/queryUserById",
		columns:[
			{field:"xuan",checkbox:true},
			{field:"name",title:"姓名"},
			{field:"userpwd",title:"密码",formatter:function (value){
						if (value!=null & value!=""){
								return "<button value='✏密码' onclick='updatePass()'></button>";
						}
				}},
			{field:"phone",title:"电话"},
			{field:"sex",title:"性别"},
			{field:"date",title:"入职日期"},
			{field:"img",title:"照片",formatter:function (value){
					return "<img src="+value+" ></img>";
				}},
			{field:"cxz",title:"操作",formatter:function(value,row){
				}},
		],
		pagination:true,
		pageSize:10,
		pageList:[2,4,6,8,10],
		sidePagination: "client",
		toolbar:"#tb",
	})
</script>
</html>